3.874 \(\int \cos ^2(c+d x) (a+b \sec (c+d x))^2 (A+B \sec (c+d x)+C \sec ^2(c+d x)) \, dx\)

Optimal. Leaf size=118 \[ \frac{1}{2} x \left (a^2 (A+2 C)+4 a b B+2 A b^2\right )+\frac{a (a B+A b) \sin (c+d x)}{d}+\frac{A \sin (c+d x) \cos (c+d x) (a+b \sec (c+d x))^2}{2 d}+\frac{b (2 a C+b B) \tanh ^{-1}(\sin (c+d x))}{d}-\frac{b^2 (A-2 C) \tan (c+d x)}{2 d} \]

[Out]

((2*A*b^2 + 4*a*b*B + a^2*(A + 2*C))*x)/2 + (b*(b*B + 2*a*C)*ArcTanh[Sin[c + d*x]])/d + (a*(A*b + a*B)*Sin[c +
 d*x])/d + (A*Cos[c + d*x]*(a + b*Sec[c + d*x])^2*Sin[c + d*x])/(2*d) - (b^2*(A - 2*C)*Tan[c + d*x])/(2*d)

________________________________________________________________________________________

Rubi [A]  time = 0.317219, antiderivative size = 118, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 6, integrand size = 41, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.146, Rules used = {4094, 4076, 4047, 8, 4045, 3770} \[ \frac{1}{2} x \left (a^2 (A+2 C)+4 a b B+2 A b^2\right )+\frac{a (a B+A b) \sin (c+d x)}{d}+\frac{A \sin (c+d x) \cos (c+d x) (a+b \sec (c+d x))^2}{2 d}+\frac{b (2 a C+b B) \tanh ^{-1}(\sin (c+d x))}{d}-\frac{b^2 (A-2 C) \tan (c+d x)}{2 d} \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2*(a + b*Sec[c + d*x])^2*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

((2*A*b^2 + 4*a*b*B + a^2*(A + 2*C))*x)/2 + (b*(b*B + 2*a*C)*ArcTanh[Sin[c + d*x]])/d + (a*(A*b + a*B)*Sin[c +
 d*x])/d + (A*Cos[c + d*x]*(a + b*Sec[c + d*x])^2*Sin[c + d*x])/(2*d) - (b^2*(A - 2*C)*Tan[c + d*x])/(2*d)

Rule 4094

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(d_.))^
(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_), x_Symbol] :> Simp[(A*Cot[e + f*x]*(a + b*Csc[e + f*x])^m*(d*
Csc[e + f*x])^n)/(f*n), x] - Dist[1/(d*n), Int[(a + b*Csc[e + f*x])^(m - 1)*(d*Csc[e + f*x])^(n + 1)*Simp[A*b*
m - a*B*n - (b*B*n + a*(C*n + A*(n + 1)))*Csc[e + f*x] - b*(C*n + A*(m + n + 1))*Csc[e + f*x]^2, x], x], x] /;
 FreeQ[{a, b, d, e, f, A, B, C}, x] && NeQ[a^2 - b^2, 0] && GtQ[m, 0] && LeQ[n, -1]

Rule 4076

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(d_.))^
(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> -Simp[(b*C*Csc[e + f*x]*Cot[e + f*x]*(d*Csc[e + f*x
])^n)/(f*(n + 2)), x] + Dist[1/(n + 2), Int[(d*Csc[e + f*x])^n*Simp[A*a*(n + 2) + (B*a*(n + 2) + b*(C*(n + 1)
+ A*(n + 2)))*Csc[e + f*x] + (a*C + B*b)*(n + 2)*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a, b, d, e, f, A, B, C,
n}, x] &&  !LtQ[n, -1]

Rule 4047

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(
C_.)), x_Symbol] :> Dist[B/b, Int[(b*Csc[e + f*x])^(m + 1), x], x] + Int[(b*Csc[e + f*x])^m*(A + C*Csc[e + f*x
]^2), x] /; FreeQ[{b, e, f, A, B, C, m}, x]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 4045

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) + (A_)), x_Symbol] :> Simp[(A*Cot[e
 + f*x]*(b*Csc[e + f*x])^m)/(f*m), x] + Dist[(C*m + A*(m + 1))/(b^2*m), Int[(b*Csc[e + f*x])^(m + 2), x], x] /
; FreeQ[{b, e, f, A, C}, x] && NeQ[C*m + A*(m + 1), 0] && LeQ[m, -1]

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx &=\frac{A \cos (c+d x) (a+b \sec (c+d x))^2 \sin (c+d x)}{2 d}+\frac{1}{2} \int \cos (c+d x) (a+b \sec (c+d x)) \left (2 (A b+a B)+(2 b B+a (A+2 C)) \sec (c+d x)-b (A-2 C) \sec ^2(c+d x)\right ) \, dx\\ &=\frac{A \cos (c+d x) (a+b \sec (c+d x))^2 \sin (c+d x)}{2 d}-\frac{b^2 (A-2 C) \tan (c+d x)}{2 d}+\frac{1}{2} \int \cos (c+d x) \left (2 a (A b+a B)+\left (2 A b^2+4 a b B+a^2 (A+2 C)\right ) \sec (c+d x)+2 b (b B+2 a C) \sec ^2(c+d x)\right ) \, dx\\ &=\frac{A \cos (c+d x) (a+b \sec (c+d x))^2 \sin (c+d x)}{2 d}-\frac{b^2 (A-2 C) \tan (c+d x)}{2 d}+\frac{1}{2} \int \cos (c+d x) \left (2 a (A b+a B)+2 b (b B+2 a C) \sec ^2(c+d x)\right ) \, dx+\frac{1}{2} \left (2 A b^2+4 a b B+a^2 (A+2 C)\right ) \int 1 \, dx\\ &=\frac{1}{2} \left (2 A b^2+4 a b B+a^2 (A+2 C)\right ) x+\frac{a (A b+a B) \sin (c+d x)}{d}+\frac{A \cos (c+d x) (a+b \sec (c+d x))^2 \sin (c+d x)}{2 d}-\frac{b^2 (A-2 C) \tan (c+d x)}{2 d}+(b (b B+2 a C)) \int \sec (c+d x) \, dx\\ &=\frac{1}{2} \left (2 A b^2+4 a b B+a^2 (A+2 C)\right ) x+\frac{b (b B+2 a C) \tanh ^{-1}(\sin (c+d x))}{d}+\frac{a (A b+a B) \sin (c+d x)}{d}+\frac{A \cos (c+d x) (a+b \sec (c+d x))^2 \sin (c+d x)}{2 d}-\frac{b^2 (A-2 C) \tan (c+d x)}{2 d}\\ \end{align*}

Mathematica [A]  time = 1.16415, size = 153, normalized size = 1.3 \[ \frac{2 (c+d x) \left (a^2 (A+2 C)+4 a b B+2 A b^2\right )+\tan (c+d x) \left (a^2 A \cos (2 (c+d x))+a^2 A+4 a (a B+2 A b) \cos (c+d x)+4 b^2 C\right )-4 b (2 a C+b B) \log \left (\cos \left (\frac{1}{2} (c+d x)\right )-\sin \left (\frac{1}{2} (c+d x)\right )\right )+4 b (2 a C+b B) \log \left (\sin \left (\frac{1}{2} (c+d x)\right )+\cos \left (\frac{1}{2} (c+d x)\right )\right )}{4 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2*(a + b*Sec[c + d*x])^2*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

(2*(2*A*b^2 + 4*a*b*B + a^2*(A + 2*C))*(c + d*x) - 4*b*(b*B + 2*a*C)*Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]]
+ 4*b*(b*B + 2*a*C)*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]] + (a^2*A + 4*b^2*C + 4*a*(2*A*b + a*B)*Cos[c + d*
x] + a^2*A*Cos[2*(c + d*x)])*Tan[c + d*x])/(4*d)

________________________________________________________________________________________

Maple [A]  time = 0.065, size = 171, normalized size = 1.5 \begin{align*}{\frac{{a}^{2}A\cos \left ( dx+c \right ) \sin \left ( dx+c \right ) }{2\,d}}+{\frac{{a}^{2}Ax}{2}}+{\frac{{a}^{2}Ac}{2\,d}}+{\frac{B{a}^{2}\sin \left ( dx+c \right ) }{d}}+{a}^{2}Cx+{\frac{C{a}^{2}c}{d}}+2\,{\frac{Aab\sin \left ( dx+c \right ) }{d}}+2\,Babx+2\,{\frac{Babc}{d}}+2\,{\frac{abC\ln \left ( \sec \left ( dx+c \right ) +\tan \left ( dx+c \right ) \right ) }{d}}+A{b}^{2}x+{\frac{A{b}^{2}c}{d}}+{\frac{B{b}^{2}\ln \left ( \sec \left ( dx+c \right ) +\tan \left ( dx+c \right ) \right ) }{d}}+{\frac{{b}^{2}C\tan \left ( dx+c \right ) }{d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2*(a+b*sec(d*x+c))^2*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x)

[Out]

1/2/d*a^2*A*cos(d*x+c)*sin(d*x+c)+1/2*a^2*A*x+1/2/d*A*a^2*c+a^2*B*sin(d*x+c)/d+a^2*C*x+1/d*C*a^2*c+2*a*A*b*sin
(d*x+c)/d+2*B*a*b*x+2/d*B*a*b*c+2/d*a*b*C*ln(sec(d*x+c)+tan(d*x+c))+A*b^2*x+1/d*A*b^2*c+1/d*B*b^2*ln(sec(d*x+c
)+tan(d*x+c))+b^2*C*tan(d*x+c)/d

________________________________________________________________________________________

Maxima [A]  time = 1.06307, size = 200, normalized size = 1.69 \begin{align*} \frac{{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A a^{2} + 4 \,{\left (d x + c\right )} C a^{2} + 8 \,{\left (d x + c\right )} B a b + 4 \,{\left (d x + c\right )} A b^{2} + 4 \, C a b{\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 2 \, B b^{2}{\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, B a^{2} \sin \left (d x + c\right ) + 8 \, A a b \sin \left (d x + c\right ) + 4 \, C b^{2} \tan \left (d x + c\right )}{4 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))^2*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="maxima")

[Out]

1/4*((2*d*x + 2*c + sin(2*d*x + 2*c))*A*a^2 + 4*(d*x + c)*C*a^2 + 8*(d*x + c)*B*a*b + 4*(d*x + c)*A*b^2 + 4*C*
a*b*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1)) + 2*B*b^2*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1))
+ 4*B*a^2*sin(d*x + c) + 8*A*a*b*sin(d*x + c) + 4*C*b^2*tan(d*x + c))/d

________________________________________________________________________________________

Fricas [A]  time = 0.548423, size = 366, normalized size = 3.1 \begin{align*} \frac{{\left ({\left (A + 2 \, C\right )} a^{2} + 4 \, B a b + 2 \, A b^{2}\right )} d x \cos \left (d x + c\right ) +{\left (2 \, C a b + B b^{2}\right )} \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) -{\left (2 \, C a b + B b^{2}\right )} \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) +{\left (A a^{2} \cos \left (d x + c\right )^{2} + 2 \, C b^{2} + 2 \,{\left (B a^{2} + 2 \, A a b\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))^2*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="fricas")

[Out]

1/2*(((A + 2*C)*a^2 + 4*B*a*b + 2*A*b^2)*d*x*cos(d*x + c) + (2*C*a*b + B*b^2)*cos(d*x + c)*log(sin(d*x + c) +
1) - (2*C*a*b + B*b^2)*cos(d*x + c)*log(-sin(d*x + c) + 1) + (A*a^2*cos(d*x + c)^2 + 2*C*b^2 + 2*(B*a^2 + 2*A*
a*b)*cos(d*x + c))*sin(d*x + c))/(d*cos(d*x + c))

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2*(a+b*sec(d*x+c))**2*(A+B*sec(d*x+c)+C*sec(d*x+c)**2),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [B]  time = 1.25563, size = 309, normalized size = 2.62 \begin{align*} -\frac{\frac{4 \, C b^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )}{\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - 1} -{\left (A a^{2} + 2 \, C a^{2} + 4 \, B a b + 2 \, A b^{2}\right )}{\left (d x + c\right )} - 2 \,{\left (2 \, C a b + B b^{2}\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + 1 \right |}\right ) + 2 \,{\left (2 \, C a b + B b^{2}\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 1 \right |}\right ) + \frac{2 \,{\left (A a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - 2 \, B a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - 4 \, A a b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - A a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 2 \, B a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 4 \, A a b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} + 1\right )}^{2}}}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))^2*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="giac")

[Out]

-1/2*(4*C*b^2*tan(1/2*d*x + 1/2*c)/(tan(1/2*d*x + 1/2*c)^2 - 1) - (A*a^2 + 2*C*a^2 + 4*B*a*b + 2*A*b^2)*(d*x +
 c) - 2*(2*C*a*b + B*b^2)*log(abs(tan(1/2*d*x + 1/2*c) + 1)) + 2*(2*C*a*b + B*b^2)*log(abs(tan(1/2*d*x + 1/2*c
) - 1)) + 2*(A*a^2*tan(1/2*d*x + 1/2*c)^3 - 2*B*a^2*tan(1/2*d*x + 1/2*c)^3 - 4*A*a*b*tan(1/2*d*x + 1/2*c)^3 -
A*a^2*tan(1/2*d*x + 1/2*c) - 2*B*a^2*tan(1/2*d*x + 1/2*c) - 4*A*a*b*tan(1/2*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c
)^2 + 1)^2)/d